home *** CD-ROM | disk | FTP | other *** search
/ Mission 3 / Mission 3.zip / Mission 3.iso / divers / pacifist / pcst048 / docs / emudtect.txt next >
Text File  |  1997-10-03  |  2KB  |  109 lines

  1. ; FOR ST Programmers - How to detect PaCifiST (0.46 of greater)
  2. ;
  3. ; When Vsync is called with D6=D7='Emu?' and those registers are
  4. ; altered, you can assume you're running under an Emulator.
  5. ;
  6. ; If D6='PaCi' & D7='fiST', then it's under PaCifiST and A0 points out
  7. ; some extra hardware registers:
  8. ;
  9. ; 0     BYTE    major version (BCD)
  10. ; 1     BYTE    minor version (BCD)
  11. ;
  12. ; Special registers will be added with each version
  13.  
  14.  
  15.  
  16.         move.l  #'Emu?',d5
  17.         move.l  d5,d7
  18.         move.l  d5,d6
  19.         move    #$25,-(a7)
  20.         trap    #$e
  21.         addq.l  #2,a7
  22.         move.l  a0,regbase
  23.  
  24.         cmp.l   d5,d6
  25.         bne.s   under_emu
  26.         cmp.l   d5,d7
  27.         beq.s   normal_st
  28. under_emu:
  29.         cmp.l  #'PaCi',d6
  30.         bne.s  other_emu
  31.         cmp.l  #'fiST',d7
  32.         bne.s  other_emu
  33.  
  34.         pea     super(pc)
  35.         move.w  #$26,-(a7)
  36.         trap    #$e
  37.         addq.l  #6,a7
  38.         lea     pacifist_emu(pc),a0
  39.         bra.s   print
  40. other_emu:
  41.     cmp.l    #"TBox",d6
  42.     beq.s    tosbox_found
  43.         lea     an_emu(pc),a0
  44.     bra.s    print
  45. normal_st:
  46.         lea     no_emu(pc),a0
  47. print:
  48.         pea     (a0)
  49.         move    #9,-(a7)
  50.         trap    #1
  51.         addq.l  #6,a7
  52.         move    #1,-(a7)
  53.         trap    #1
  54.         addq.l  #2,a7
  55.         clr.w   -(a7)
  56.         trap    #1
  57.  
  58. super:
  59.         move.l  regbase(pc),a0
  60.         move.b  (a0),d0
  61.         add.b   d0,majorv
  62.         move.b  1(a0),d0
  63.         move    d0,d1
  64.         lsr     #4,d1
  65.         and     #$f,d0
  66.         and     #$f,d1
  67.         add.b   d1,minorv
  68.         add.b   d0,minorv+1
  69.         rts
  70.  
  71. tosbox_found:
  72.     move.l    #tosbver+1,d0
  73.     and    #$fffe,d0
  74.     move.l    d0,a0
  75.         move.l  d7,(a0)
  76.     lea    tosbox_emu(pc),a0
  77.     bra.s    print
  78.  
  79.     SECTION DATA
  80.  
  81. regbase    dc.l    0
  82.  
  83.         ;----- no emulator found
  84.  
  85. no_emu:
  86.         dc.b    "It seems you're running under a",13,10
  87.         dc.b    "mere ST.",0
  88.  
  89.         ;----- unknown emulator
  90.  
  91. an_emu:
  92.         dc.b    "It seems you're running under an",13,10
  93.         dc.b    "emulator.",0
  94.  
  95.         ;----- PaCifiST
  96.  
  97. pacifist_emu:
  98.         dc.b    "You're running under PaCifiST v"
  99. majorv: dc.b    "0."
  100. minorv: dc.b    "00.",0
  101.  
  102.         ;----- TOSBOX
  103.  
  104. tosbox_emu:
  105.     dc.b    "You re running under TOSBOX "
  106. tosbver    dcb.b    32,5
  107.     dc.b    10,13,0
  108.     
  109.